<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Location对象</title>
</head>
<body>

<input type="button" id = "btn" value="刷新">

<input type="button" id = "btn2" value="进入b站">
<script>
    //获取按钮
    var btn = document.getElementById("btn");
    btn.onclick = function(){
        location.reload();
        //使用reload刷新当前页面
    }

    var href = location.href;
    alert(href);
    //获取现在的地址

     var btn2 = document.getElementById("btn2");
     btn2.onclick = function(){
        //进入b站
        location.href = "https://www.bilibili.com";
     }
</script>
</body>
</html>